package com.taotao.designpattern.event.job;

import java.util.Objects;

/**
 * @author fanbeibei
 * @version 1.0
 * @date 2021/1/5 15:32
 */
public abstract class AbstractJob implements Job {

    protected Long jobId;
    protected String cron;

    public AbstractJob(Long jobId) {
        this.jobId = jobId;
    }

    public AbstractJob(Long jobId, String cron) {
        this.jobId = jobId;
        this.cron = cron;
    }

    @Override
    public Long getJobId() {
        return jobId;
    }

    @Override
    public String getCron() {
        return cron;
    }

    @Override
    public boolean isDrivenJob() {
        return null == cron || Objects.equals("", cron.trim());
    }
}
